layui.use(['form', 'jquery', 'layer'], function () {
    var form = layui.form,
        layer = layui.layer,
        $ = layui.jquery;

    $('#addBtn').click(function () {
        var data = new FormData(document.getElementById("formExcel"));

        $.ajax({
            url: ctx + '/file/importExcel',
            type: "post",
            data: data,
            processData: false,
            contentType: false,
            success: function (data) {
                if (data.code == 200) {
                    layer.msg(data.msg, {icon: 6, time: 2000});
                    layer.closeAll("iframe");
                    parent.location.reload();
                }
            }, error: function (data) {
                top.layer.msg(data.msg);
                layer.closeAll("iframe");

            }
        })
        return false;
    })
});